import type { MockMethod } from 'vite-plugin-mock'
import Mock from 'mockjs'

const rules: MockMethod[] = [
  {
    url: '/institutionalFramework/message/list',
    method: 'get',
    timeout: 1000,
    response: () => {
      const data = []
      for (let i = 0; i < 6; i++) {
        data.push(
          Mock.mock({
            id: '@id',
            title: '@ctitle(3,10)',
            // center: "@title",
            address: '@province@city@county(true)@zip',
            name: '@cname',
            phone: '13789098765',
            'number|1-1000': 1000,
            equipment: '@integer(1,700)'
          })
        )
      }
      return {
        code: 1,
        message: '获取数据成功',
        data
      }
    }
  },
  {
    url: '/login',
    method: 'post',
    timeout: 1000,
    response: () => {
      const data = Mock.mock({
        token: '@string(11)'
      })
      return {
        code: 1,
        message: '获取数据成功',
        data
      }
    }
  }
]

export default rules
